a few more const_cast eliminations.
authortsteven4 <tsteven4@gmail.com>
Sun, 1 Jul 2018 19:23:38 +0000 (13:23 -0600)
committertsteven4 <tsteven4@gmail.com>
Sun, 1 Jul 2018 19:23:38 +0000 (13:23 -0600)
gdb.cc
trackfilter.cc

diff --git a/gdb.cc b/gdb.cc
index e1a2f99c80a783938587c633192ba2c2d89e324b..030d40e161c71dce61321b2c8381efce095c7bb8 100644 (file)
--- a/gdb.cc
+++ b/gdb.cc
@@ -1631,7 +1631,7 @@ write_waypoint_cb(const Waypoint* refpt)
 // but, but, casting away the const here is wrong...
   (const_cast<Waypoint*>(refpt))->shortname = refpt->shortname.trimmed();
 #else
-  rtrim(((Waypoint*)refpt)->shortname);
+  rtrim(const_cast<Waypoint*>(refpt))->shortname);
 #endif
   test = gdb_find_wayptq(&wayptq_out, refpt, 1);
 
index 22ddcd86a51508528fc4af3d3cdaf82f0073e7b9..df783cd7fcf2ceb170cd46d43e8418379e88e9ca 100644 (file)
@@ -60,7 +60,7 @@ int TrackFilter::trackfilter_parse_time_opt(const char* arg)
 {
   time_t t0, t1;
   int sign = 1;
-  char* cin = const_cast<char*>(arg);
+  const char* cin = arg;
   char c;
 
   t0 = t1 = 0;
@@ -741,13 +741,13 @@ time_t TrackFilter::trackfilter_range_check(const char* timestr)
   int i;
   char fmt[20];
   char c;
-  char* cin;
+  const char* cin;
   struct tm time;
 
 
   i = 0;
   strncpy(fmt, "00000101000000", sizeof(fmt));
-  cin = const_cast<char*>(timestr);
+  cin = timestr;
 
   while ((c = *cin++)) {
     if (fmt[i] == '\0') {